home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / math / ucalc30c.zip / EXAMPLES.DOC < prev    next >
Text File  |  1996-04-17  |  7KB  |  223 lines

  1. Ultimate Calculator v3.0c (Unregistered)   [F1] for help
  2. Copyright (C) 1992-1996 by Daniel Corbier.  All rights reserved.
  3.  
  4. ucalc> ;*******************************************************************
  5. ucalc> ;  This text file is a sample session which demonstrates some of the
  6. ucalc> ;  features available in the Ultimate Calculator.  The sections are
  7. ucalc> ;  entitled:
  8. ucalc> ;
  9. ucalc> ;  1. General Calculations
  10. ucalc> ;  2. Physics for Thought
  11. ucalc> ;  3. HBO for Thought
  12. ucalc> ;  4. Are you converted yet?
  13. ucalc> ;  5. Let's use some FORCE
  14. ucalc> ;  6. How to pay
  15. ucalc> ;  7. Let's get a few FACTS straight
  16. ucalc> ;*******************************************************************
  17. ucalc> 
  18. ucalc> ; ***********************
  19. ucalc> ; 1. General Calculations
  20. ucalc> ; ***********************
  21. ucalc> 
  22. ucalc> 17*(5+8)^2
  23. Answer:  2873
  24.  
  25. ucalc> cos(pi)+8/pi + sinh(14)
  26. Answer:  601303.688561062095
  27.  
  28. ucalc> test(x) = x^pi + sin(x)   ; User defined function.
  29. ucalc> test(14)
  30. Answer:  3988.18506502600842
  31.  
  32. ucalc> sum(x*2+3^x,1..100)       ; Summation
  33. Answer:  7.73066281098016997E+47
  34.  
  35. ucalc> 
  36. ucalc> ; **********************
  37. ucalc> ; 2. Physics for Thought
  38. ucalc> ; **********************
  39. ucalc> 
  40. ucalc> mass   = 77.2     ; g
  41. ucalc> Volume = 4.0      ; cm^3
  42. ucalc> 
  43. ucalc> mass / Volume     ; Density
  44. Answer:  19.3
  45.  
  46. ucalc> 
  47. ucalc> mass = 13         ; Lets try a different mass
  48. ucalc> 
  49. ucalc> mass / Volume     ; Now lets see the new density
  50. Answer:  3.25
  51.  
  52. ucalc> ; Quantum Mechanics
  53. ucalc> 
  54. ucalc> h = 6.63E-34      ; J s
  55. ucalc> m = 9.11E-31      ; kg
  56. ucalc> L = 2E-11         ; m
  57. ucalc> 
  58. ucalc> E(x) = (h^2/(8*m*L^2))*x^2  ; Allowed energies for a particle in a box.
  59. ucalc> 
  60. ucalc> E(1)
  61. Answer:  1.50785194840834248E-16
  62.  
  63. ucalc>              ; Oops, you meant L=2E-10, no problem use the Up arrow.
  64. ucalc> L = 2E-10
  65. ucalc> E(1)       ; You didn't have to retype the eq. !  Time saver, isn't it?
  66. Answer:  1.50785194840834248E-18
  67.  
  68. ucalc> E(5)
  69. Answer:  3.7696298710208562E-17
  70.  
  71. ucalc> 
  72. ucalc> ; ******************
  73. ucalc> ; 3. HBO for Thought
  74. ucalc> ; ******************
  75. ucalc> 
  76. ucalc> mode hbo        ; Results will be displayed in Hex, Binary, and Octal
  77.  
  78. ucalc> 
  79. ucalc> #h1E or #hAFF   ; ORing two hexadecimal numbers
  80. Decimal:  2815     Hex:  AFF     Binary:  101011111111     Octal:  5377
  81.  
  82. ucalc> 
  83. ucalc> $1E or $AFF     ; Same as above (shortcut notation for hex)
  84. Decimal:  2815     Hex:  AFF     Binary:  101011111111     Octal:  5377
  85.  
  86. ucalc> 
  87. ucalc> #b1010101 or #b111000 + 44/2
  88. Decimal:  95     Hex:  5F     Binary:  1011111     Octal:  137
  89.  
  90. ucalc> 
  91. ucalc> mode hbo        ; Toggle HBO mode back off
  92.  
  93. ucalc> 
  94. ucalc> ; *************************
  95. ucalc> ; 4. Are you converted yet?
  96. ucalc> ; *************************
  97. ucalc> 
  98. ucalc> feet_inches(x) = x * 12       ; You can put these and more in
  99. ucalc> meters_feet(x) = 3.281 * x    ; UCALC.DEF if you use them often.
  100. ucalc> celsius_fa(x)  = 9/5 * x + 32 ; Celsius to Fahrenheit.
  101. ucalc> 
  102. ucalc> celsius_fa(50)
  103. Answer:  122
  104.  
  105. ucalc> feet_inches(3)
  106. Answer:  36
  107.  
  108. ucalc> 
  109. ucalc> ; ***********************
  110. ucalc> ; 5. Let's use some FORCE
  111. ucalc> ; ***********************
  112. ucalc> 
  113. ucalc> ; FORCE = integral( pgh dA )
  114. ucalc> 
  115. ucalc> integ 3x^2*(x+7),4..7
  116. Answer:  3561.75
  117.  
  118. ucalc> integ 6.24*(3-x)*2*sqr(9-x^2),-3..3,1000 ; 1000 for higher precision
  119. Answer:  529.288609103337383
  120.  
  121. ucalc> 
  122. ucalc> ; *************
  123. ucalc> ; 6. How to pay
  124. ucalc> ; *************
  125. ucalc> 
  126. ucalc> ; You can do all your financial calculations with UCALC.
  127. ucalc> 
  128. ucalc> ; Lets take a loan to buy a nice house
  129. ucalc> 
  130. ucalc> payment(PV,i,n) = PV*i/(1-(1+i)^(-n))   ; Formula for monthly payments
  131. ucalc> 
  132. ucalc> PV = 175000           ; Loan balance
  133. ucalc> i  = .01              ; Interest rate (1% monthly)
  134. ucalc> n  = 240              ; Number of payments (20 years)
  135. ucalc> 
  136. ucalc> payment(PV,i,n)
  137. Answer:  1926.90073374681746
  138.  
  139. ucalc> n  = 360              ; Maybe we can negotiate better terms
  140. ucalc> 
  141. ucalc> payment(PV,i,n)
  142. Answer:  1800.07204461963275
  143.  
  144. ucalc> payment(215000,i,n)       ; Can we afford a bigger loan?
  145. Answer:  2211.51708338983452
  146.  
  147. ucalc> 
  148. ucalc> ; You want to become a millionaire by investing $50,000 and
  149. ucalc> ; earning 14% interest each year.  How many years will it take?
  150. ucalc> 
  151. ucalc> Term(FV,PV,i) = ln(FV/PV) / ln(1+i)
  152. ucalc> 
  153. ucalc> FV = 1000000          ; Future investment value
  154. ucalc> PV = 50000            ; Present investment value
  155. ucalc> i  = .14              ; Annual interest
  156. ucalc> 
  157. ucalc> Term(FV,PV,i)
  158. Answer:  22.8632526947680305
  159.  
  160. ucalc> ; It will take around 23 years
  161. ucalc> 
  162. ucalc> ; *********************************
  163. ucalc> ; 7. Let's get a few FACTS straight
  164. ucalc> ; *********************************
  165. ucalc> 
  166. ucalc> FACT(1500)*2
  167. Answer:  9.62399559355954972E+4114
  168.  
  169. ucalc> 1500!*2   ; version 2.+ now supports the factorial (!) symbol.
  170. Answer:  9.62399559355954972E+4114
  171.  
  172. ucalc> ; Wow, not even the US budget deficit is that big of a number.
  173. ucalc> ; Can your pocket calculator get a factorial that high?
  174. ucalc> 
  175. ucalc> solve( exp(x)+3*x = 15 )
  176. Answer:  2.14698767937181217
  177.  
  178. ucalc>             ; 'last' stores the answer to the previous operation.
  179. ucalc> exp(last)+3*last  ; You can use that concept for accuracy checks.
  180. Answer:  15
  181.  
  182. ucalc> solve( sin(x) = 1, 0..pi )
  183. Answer:  1.57079632679489662
  184.  
  185. ucalc> sumtable(x^2+2*x,0..10)
  186. Count         Value         Cumulative
  187.  0             0             0
  188.  1             3             3
  189.  2             8             11
  190.  3             15            26
  191.  4             24            50
  192.  5             35            85
  193.  6             48            133
  194.  7             63            196
  195.  8             80            276
  196.  9             99            375
  197.  10            120           495
  198. Answer:  495
  199.  
  200. ucalc> 
  201. ucalc> ; Compound functions can be defined by using relational operators.
  202. ucalc> 
  203. ucalc> ;           /  x^2+3,       x > 0
  204. ucalc> ; tst(x) = |   2,           x = 0
  205. ucalc> ;           \  x^2-3,       x < 0
  206. ucalc> 
  207. ucalc> tst(x) = (x^2+3)*(x>0)  +  (2)*(x=0)  +  (x^2-3)*(x<0)
  208. ucalc> tst(15)
  209. Answer:  228
  210.  
  211. ucalc> tst(-8)
  212. Answer:  61
  213.  
  214. ucalc> 3*tst(0)^2+pi
  215. Answer:  15.1415926535897932
  216.  
  217. ucalc> 
  218. ucalc> ; These are just some of the things you can do with UCALC.
  219. ucalc> 
  220. ucalc> ; Please remember to pay the registration fee.  This will allow me
  221. ucalc> ; to spend the necessary amount of time in order to add some of the
  222. ucalc> ; features that you would like to see in the next version.
  223.